<script setup lang="ts">
import type { EaInvoiceRecord } from './type'

const baseApi = '/ea/ea-invoice-record'

const { loadData, loading, model } = useDetail<EaInvoiceRecord>(baseApi)

defineExpose({ init: loadData })
</script>

<template>
  <el-empty v-if="!Object.keys(model).length" v-loading="loading" />
  <el-descriptions v-else v-loading="loading" :column="1" border>
    <el-descriptions-item label="发票抬头Id" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.invoiceIdLabel }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="任务Id" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.taskId }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="审核时间" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.approveTime }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="开票金额" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.price }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="开票状态" label-class-name="item-label" label-align="right">
      <el-tag v-if="model.invoiceStatusLabel" :color="model.invoiceStatusLabel.ext?.color" effect="dark" type="info">
        {{ model.invoiceStatusLabel?.label }}
      </el-tag>
    </el-descriptions-item>
    <!-- <el-descriptions-item label="拒绝原因" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.reason }}
      </span>
    </el-descriptions-item> -->
    <el-descriptions-item label="发票抬头" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.invoiceName }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="发票类型" label-class-name="item-label" label-align="right">
      <el-tag v-if="model.invoiceTypeLabel" :color="model.invoiceTypeLabel.ext?.color" effect="dark" type="info">
        {{ model.invoiceTypeLabel?.label }}
      </el-tag>
    </el-descriptions-item>
    <el-descriptions-item label="税号" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.taxId }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="邮箱" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.email }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="客户Id" label-class-name="item-label" label-align="right">
      <span class="txt-short">
        {{ model.memberId }}
      </span>
    </el-descriptions-item>
  </el-descriptions>
</template>

<style scoped lang="scss">
.el-descriptions {
  :deep(.el-descriptions__header) {
    margin: 0 10px 12px;
  }

  :deep(.item-label) {
    width: 120px;
  }
}
</style>
